import request from '@/utils/request'
import type { Post } from './post'

export interface Announcement {
  id: number
  title: string
  content: string
  type: number
  createdAt: string
  date: string
  link?: string
  category?: string
}

export interface ActiveUser {
  id: number
  username: string
  avatar: string
  postsCount: number
  commentsCount: number
  likesCount: number
}

// 基础路径 - post-service context-path 是 /post，然后 HomeController 的 @RequestMapping 是 /home
const baseUrl = '/api/post/home'

// 获取热门帖子
export function getHotPosts() {
  return request({
    url: `${baseUrl}/hot-posts`,
    method: 'get'
  })
}

// 获取最新帖子
export function getLatestPosts() {
  return request({
    url: `${baseUrl}/latest-posts`,
    method: 'get'
  })
}

// 获取公告列表
export function getAnnouncements() {
  return request({
    url: `${baseUrl}/announcements`,
    method: 'get'
  })
}

// 获取活跃用户
export function getActiveUsers() {
  return request({
    url: `${baseUrl}/active-users`,
    method: 'get'
  })
} 